//Adventurer Card
#include "dominion.h"
#include "dominion_helpers.h"
#include "rngs.h"
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <assert.h>

int main(int argc, char const *argv[])
{
	struct gameState state;
	int player;
	int i, j, hand;
	int t_count = 0;
	int pt_count = 0;

	for(i = 0; i < 2000; i++){
		for (j = 0; j < sizeof(struct gameState); j++) {
			((char*)&state)[i] = floor(Random() * 256);
		}
		player = rand() % 5;
		drawntreasure = rand() % 3;
		state.deckCount[player] = rand() % MAX_DECK;
		state.handCount[player] = rand() % MAX_HAND;
		hand = state.handCount[player];
		for(j = 0; j < hand; j++){
			state.hand[player][j] = rand() % 27;
			if(state.hand[player][j] == 4 || state.hand[player][j] == 5 || state.hand[player][j] == 6){
				t_count += 1;
			}
		}
		adventCard(0, &state, player);
		if(state.handCount[player] == hand + 1){ // +2 Treasures, -1 adventurer card
			printf("Pass: Hand Count");

		}else{
			printf("Fail: Hand Count. Had %d, have %d\n", hand, state.handCount[player] );
		}
		for(j = 0; j < state.handCount[player]; j++){
			if(state.hand[player][j] == 4 || state.hand[player][j] == 5 || state.hand[player][j] == 6){
				pt_count += 1;
			}
		}
		if(pt_count == tcount + 2){
			printf("Pass: Treasure Count\n");
		} else{
			printf("Fail: Treasure Count. Had %d, have %d\n", t_count, pt_count);
		}
	}


	return 0;
}